package com.blog.controller;

import com.blog.service.ArticleService;
import com.blog.service.impl.ArticleServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/AddArticleStar.do")
public class AddArticleStarServlet extends HttpServlet {
    ArticleService articleService= new ArticleServiceImpl();
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String articleId = req.getParameter("articleId");
        //System.out.println(articleId);
        //根据id,进行点赞数加一
        int  i= articleService.addArticleStar(articleId);
            //删除成功
            req.getRequestDispatcher("/ArticleDetailServlet.do?id="+articleId).forward(req,resp);



    }
}
